package com.yilin.tms.core.entity.order.payment;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yilin.tms.core.commons.base.BaseDataEntity;
import com.yilin.tms.core.entity.capital.TradeRecord;
import com.yilin.tms.core.entity.order.goods.GoodsOrder;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 *
 * */
@Entity
@Table(name = "order_payment_cost")
@TableName(value = "order_payment_cost")
public class OrderPaymentCost extends BaseDataEntity {

    public enum PaySite {
        release(0,"发布支付"),
        robSuccess(1,"抢单成功"),
        delivery(2,"发货支付"),
        receipt(3,"收货支付"),
        clearing(4,"清算支付");
        @EnumValue
        public Integer index;
        public String name;

        PaySite(Integer index, String name) {
            this.index = index;
            this.name = name;
        }
    }

    /**
     * 支付状态
     */
    public enum PayStatus {
        none(0, "无需支付"),//无需支付
        create(1, "已创建"),//等待发起支付
        wait(2, "等待中"),//已在支付流程中
        complete(3, "完成支付"),//完成支付
        cancel(4, "取消");//作废
        @EnumValue
        public Integer index;
        public String name;

        PayStatus(Integer index, String name) {
            this.index = index;
            this.name = name;
        }
    }

    @Column(name = "pay_site")
    private PaySite paySite;
    //货主
    @Column(name = "shipper_account_id")
    private String shipperAccountId;//货主账号
    @Column(name = "shipper_account_name")
    private String shipperAccountName;//
    @Column(name = "shipper_organize_id")
    private String shipperOrganizeId;//
    @Column(name = "shipper_organize_name")
    private String shipperOrganizeName;//
    //指向订单
    @Column(name = "transit_order_id")
    private String transitOrderId;//运单ID
    @Column(name = "rob_order_id")
    private String robOrderId;//抢单ID
    @Column(name = "goods_order_id")
    private String goodsOrderId;//货单ID
    @Column(name = "clear_order_id")
    private String clearOrderId;//清算单ID
    //指向订单号
    @Column(name = "transport_no")
    private String transportNo;//运单号
    @Column(name = "rob_order_no")
    private String robOrderNo;//抢单号
    @Column(name = "goods_order_no")
    private String goodsOrderNo;//货单号
    @Column(name = "clear_order_No")
    private String clearOrderNo;//清算单号
    //撮合业务
    @Column(name = "matchmaking")
    private Boolean matchmaking;//是否撮合业务
    @Column(name = "included_tax")
    private Boolean includedTax;//运费是否含税
    // 支付计划【费率】
    @Column(name = "release_payment_rate")
    private Double releasePaymentRate  = 0D; //发布付款比例   /// 付款比例：设置付款比例后比例付款，付款前均判断
    @Column(name = "rob_payment_rate")
    private Double robPaymentRate  = 0D; //抢单付款比例
    @Column(name = "deliver_payment_rate")
    private Double deliverPaymentRate  = 0D; //发货付款比例
    @Column(name = "arrival_payment_rate")
    private Double arrivalPaymentRate  = 0D; //货到付款比例 ///如果是自动结算 比例无效 默认尾款全付
    @Column(name = "shipper_fee_rate")
    private Double shipperFeeRate; // 货主手续费率
    @Column(name = "shipper_tax_rate")
    private Double shipperTaxRate;// 货主预付不含税税率
    @Column(name = "insurance_rate")
    private Double insuranceRate; // 保率

    //A1固定拆分费用列表 死费用
    @Column(name = "split_additional_cost")
    private Double splitAdditionalCost; //【上级拆分后的】附加费用总费用 例：装卸费
    @Column(name = "split_insurance_cost")
    private Double splitInsuranceCost; //【上级拆分后的】保费
    @Column(name = "split_insurance_amount")
    private Double splitInsuranceAmount; //【上级拆分后的】保额
    @Column(name = "split_already_pay_cost")
    private Double splitAlreadyPayCost; //【上级拆分后的】上阶段已经支付【成功】的费用
    //A2:运输费用列表
    @Column(name = "settlement_type")
    private GoodsOrder.SettlementType settlementType;//当前使用的结算方式  必定等于 发布结算/抢单结算/发货结算
    @Column(name = "transport_cost")
    private Double transportCost; //运输费
    @Column(name = "tax_cost")
    private Double taxCost;//额外税费 非撮合=0
    @Column(name = "actual_transport_cost")
    private Double actualTransportCost; //【实际运费】 ： 实际含税运输费 = transportCost+taxCost
    @Column(name = "shipper_fee_cost")
    private Double shipperFeeCost; //货主手续费--货主
    // 总支付合计 = 含税实际运费+货主手续费+保费+附加费
    @Column(name = "actual_total_cost")
    private Double actualTotalCost; // 最总实际支付的总费用

    //---------------------------------------------------------------------------------------

    //B:实际支付小计 无需支付全部==0
    @Column(name = "pay_insurance_cost")
    private Double payInsuranceCost; //【实际支付】保费
    @Column(name = "pay_additional_cost")
    private Double payAdditionalCost; //【实际支付】附加费
    @Column(name = "pay_transport_cost")
    private Double payTransportCost; //【实际支付】运输费
    @Column(name = "pay_tax_cost")
    private Double payTaxCost; //【实际支付】税
    @Column(name = "pay_shipper_fee_cost")
    private Double payShipperFeeCost; //【实际支付】手续费
    //实际支付费用合计 无需支付==0 = 含税实际运费+货主手续费+保费+附加费
    @Column(name = "pay_cost")
    private Double payCost;

    // 时间线
    @Column(name = "pay_create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payCreateTime;
    @Column(name = "pay_initiate_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payInitiateTime;
    @Column(name = "pay_complete_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payCompleteTime;
    // 基本支付数据
    @Column(name = "pre_payment_no")
    private String prePaymentNo ;//预付单号
    @Column(name = "pay_status")
    private PayStatus payStatus;//支付状态
    @Column(name = "pay_type")
    private TradeRecord.PayType payType;// 交易方式
    @Column(name = "trade_no")
    private String tradeNo;//交易单号(平台流水号)
    @Column(name = "pay_remark")
    private String payRemark;//付款说明
    // 付款操作人
    @Column(name = "initiate_user_id")
    private String initiateUserId;//付款发起人 create:zjy 2022/8/3
    @Column(name = "initiate_user_name")
    private String initiateUserName;//付款发起人名称 create:zjy 2022/8/3
    @Column(name = "opt_user_id")
    private String optUserId;//付款操作人ID create:zjy 2022/8/3
    @Column(name = "opt_user_name")
    private String optUserName;//付款操作人名称 create:zjy 2022/8/3
    // 第三方支付数据
    @Column(name = "payment_type_name")
    private String paymentTypeName;//支付银行/平台名称
    @Column(name = "payment_safe_code")
    private String paymentSafeCode;//新增安全码，用于通知结果时验证支付结果安全
    @Column(name = "bank_flow_no")
    private String bankFlowNo;//银行流水号（银行/第三方)
    @Column(name = "payment_capital_account")
    private String paymentCapitalAccount;//付款资金账号/卡号/微信ID/支付宝ID 等
    @Column(name = "income_capital_account")
    private String incomeCapitalAccount;//收款资金账号/卡号/微信ID/支付宝ID 等

    public String getPaymentTypeName() {
        return paymentTypeName;
    }

    public void setPaymentTypeName(String paymentTypeName) {
        this.paymentTypeName = paymentTypeName;
    }

    public String getTransportNo() {
        return transportNo;
    }

    public void setTransportNo(String transportNo) {
        this.transportNo = transportNo;
    }

    public String getRobOrderNo() {
        return robOrderNo;
    }

    public void setRobOrderNo(String robOrderNo) {
        this.robOrderNo = robOrderNo;
    }

    public String getGoodsOrderNo() {
        return goodsOrderNo;
    }

    public void setGoodsOrderNo(String goodsOrderNo) {
        this.goodsOrderNo = goodsOrderNo;
    }

    public String getClearOrderNo() {
        return clearOrderNo;
    }

    public void setClearOrderNo(String clearOrderNo) {
        this.clearOrderNo = clearOrderNo;
    }

    public String getPrePaymentNo() {
        return prePaymentNo;
    }

    public void setPrePaymentNo(String prePaymentNo) {
        this.prePaymentNo = prePaymentNo;
    }

    public Date getPayInitiateTime() {
        return payInitiateTime;
    }

    public void setPayInitiateTime(Date payInitiateTime) {
        this.payInitiateTime = payInitiateTime;
    }

    public String getShipperAccountId() {
        return shipperAccountId;
    }

    public void setShipperAccountId(String shipperAccountId) {
        this.shipperAccountId = shipperAccountId;
    }

    public String getShipperAccountName() {
        return shipperAccountName;
    }

    public void setShipperAccountName(String shipperAccountName) {
        this.shipperAccountName = shipperAccountName;
    }

    public String getShipperOrganizeId() {
        return shipperOrganizeId;
    }

    public void setShipperOrganizeId(String shipperOrganizeId) {
        this.shipperOrganizeId = shipperOrganizeId;
    }

    public String getShipperOrganizeName() {
        return shipperOrganizeName;
    }

    public void setShipperOrganizeName(String shipperOrganizeName) {
        this.shipperOrganizeName = shipperOrganizeName;
    }

    public String getPaymentSafeCode() {
        return paymentSafeCode;
    }

    public void setPaymentSafeCode(String paymentSafeCode) {
        this.paymentSafeCode = paymentSafeCode;
    }

    public String getInitiateUserId() {
        return initiateUserId;
    }

    public void setInitiateUserId(String initiateUserId) {
        this.initiateUserId = initiateUserId;
    }

    public String getInitiateUserName() {
        return initiateUserName;
    }

    public void setInitiateUserName(String initiateUserName) {
        this.initiateUserName = initiateUserName;
    }

    public String getClearOrderId() {
        return clearOrderId;
    }

    public void setClearOrderId(String clearOrderId) {
        this.clearOrderId = clearOrderId;
    }

    public PaySite getPaySite() {
        return paySite;
    }

    public void setPaySite(PaySite paySite) {
        this.paySite = paySite;
    }

    public String getTransitOrderId() {
        return transitOrderId;
    }

    public void setTransitOrderId(String transitOrderId) {
        this.transitOrderId = transitOrderId;
    }

    public String getRobOrderId() {
        return robOrderId;
    }

    public void setRobOrderId(String robOrderId) {
        this.robOrderId = robOrderId;
    }

    public String getGoodsOrderId() {
        return goodsOrderId;
    }

    public void setGoodsOrderId(String goodsOrderId) {
        this.goodsOrderId = goodsOrderId;
    }

    public Boolean getMatchmaking() {
        return matchmaking;
    }

    public void setMatchmaking(Boolean matchmaking) {
        this.matchmaking = matchmaking;
    }

    public Boolean getIncludedTax() {
        return includedTax;
    }

    public void setIncludedTax(Boolean includedTax) {
        this.includedTax = includedTax;
    }

    public Double getReleasePaymentRate() {
        return releasePaymentRate;
    }

    public void setReleasePaymentRate(Double releasePaymentRate) {
        this.releasePaymentRate = releasePaymentRate;
    }

    public Double getRobPaymentRate() {
        return robPaymentRate;
    }

    public void setRobPaymentRate(Double robPaymentRate) {
        this.robPaymentRate = robPaymentRate;
    }

    public Double getDeliverPaymentRate() {
        return deliverPaymentRate;
    }

    public void setDeliverPaymentRate(Double deliverPaymentRate) {
        this.deliverPaymentRate = deliverPaymentRate;
    }

    public Double getArrivalPaymentRate() {
        return arrivalPaymentRate;
    }

    public void setArrivalPaymentRate(Double arrivalPaymentRate) {
        this.arrivalPaymentRate = arrivalPaymentRate;
    }

    public Double getShipperFeeRate() {
        return shipperFeeRate;
    }

    public void setShipperFeeRate(Double shipperFeeRate) {
        this.shipperFeeRate = shipperFeeRate;
    }

    public Double getShipperTaxRate() {
        return shipperTaxRate;
    }

    public void setShipperTaxRate(Double shipperTaxRate) {
        this.shipperTaxRate = shipperTaxRate;
    }

    public Double getInsuranceRate() {
        return insuranceRate;
    }

    public void setInsuranceRate(Double insuranceRate) {
        this.insuranceRate = insuranceRate;
    }

    public Double getSplitAdditionalCost() {
        return splitAdditionalCost;
    }

    public void setSplitAdditionalCost(Double splitAdditionalCost) {
        this.splitAdditionalCost = splitAdditionalCost;
    }

    public Double getSplitInsuranceCost() {
        return splitInsuranceCost;
    }

    public void setSplitInsuranceCost(Double splitInsuranceCost) {
        this.splitInsuranceCost = splitInsuranceCost;
    }

    public Double getSplitInsuranceAmount() {
        return splitInsuranceAmount;
    }

    public void setSplitInsuranceAmount(Double splitInsuranceAmount) {
        this.splitInsuranceAmount = splitInsuranceAmount;
    }

    public Double getSplitAlreadyPayCost() {
        return splitAlreadyPayCost;
    }

    public void setSplitAlreadyPayCost(Double splitAlreadyPayCost) {
        this.splitAlreadyPayCost = splitAlreadyPayCost;
    }

    public GoodsOrder.SettlementType getSettlementType() {
        return settlementType;
    }

    public void setSettlementType(GoodsOrder.SettlementType settlementType) {
        this.settlementType = settlementType;
    }

    public Double getTransportCost() {
        return transportCost;
    }

    public void setTransportCost(Double transportCost) {
        this.transportCost = transportCost;
    }

    public Double getTaxCost() {
        return taxCost;
    }

    public void setTaxCost(Double taxCost) {
        this.taxCost = taxCost;
    }

    public Double getActualTransportCost() {
        return actualTransportCost;
    }

    public void setActualTransportCost(Double actualTransportCost) {
        this.actualTransportCost = actualTransportCost;
    }

    public Double getShipperFeeCost() {
        return shipperFeeCost;
    }

    public void setShipperFeeCost(Double shipperFeeCost) {
        this.shipperFeeCost = shipperFeeCost;
    }

    public Double getActualTotalCost() {
        return actualTotalCost;
    }

    public void setActualTotalCost(Double actualTotalCost) {
        this.actualTotalCost = actualTotalCost;
    }

    public Double getPayInsuranceCost() {
        return payInsuranceCost;
    }

    public void setPayInsuranceCost(Double payInsuranceCost) {
        this.payInsuranceCost = payInsuranceCost;
    }

    public Double getPayAdditionalCost() {
        return payAdditionalCost;
    }

    public void setPayAdditionalCost(Double payAdditionalCost) {
        this.payAdditionalCost = payAdditionalCost;
    }

    public Double getPayTransportCost() {
        return payTransportCost;
    }

    public void setPayTransportCost(Double payTransportCost) {
        this.payTransportCost = payTransportCost;
    }

    public Double getPayTaxCost() {
        return payTaxCost;
    }

    public void setPayTaxCost(Double payTaxCost) {
        this.payTaxCost = payTaxCost;
    }

    public Double getPayShipperFeeCost() {
        return payShipperFeeCost;
    }

    public void setPayShipperFeeCost(Double payShipperFeeCost) {
        this.payShipperFeeCost = payShipperFeeCost;
    }

    public Double getPayCost() {
        return payCost;
    }

    public void setPayCost(Double payCost) {
        this.payCost = payCost;
    }

    public Date getPayCreateTime() {
        return payCreateTime;
    }

    public void setPayCreateTime(Date payCreateTime) {
        this.payCreateTime = payCreateTime;
    }

    public Date getPayCompleteTime() {
        return payCompleteTime;
    }

    public void setPayCompleteTime(Date payCompleteTime) {
        this.payCompleteTime = payCompleteTime;
    }

    public PayStatus getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(PayStatus payStatus) {
        this.payStatus = payStatus;
    }

    public TradeRecord.PayType getPayType() {
        return payType;
    }

    public void setPayType(TradeRecord.PayType payType) {
        this.payType = payType;
    }

    public String getTradeNo() {
        return tradeNo;
    }

    public void setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
    }

    public String getPayRemark() {
        return payRemark;
    }

    public void setPayRemark(String payRemark) {
        this.payRemark = payRemark;
    }

    public String getOptUserId() {
        return optUserId;
    }

    public void setOptUserId(String optUserId) {
        this.optUserId = optUserId;
    }

    public String getOptUserName() {
        return optUserName;
    }

    public void setOptUserName(String optUserName) {
        this.optUserName = optUserName;
    }

    public String getBankFlowNo() {
        return bankFlowNo;
    }

    public void setBankFlowNo(String bankFlowNo) {
        this.bankFlowNo = bankFlowNo;
    }

    public String getPaymentCapitalAccount() {
        return paymentCapitalAccount;
    }

    public void setPaymentCapitalAccount(String paymentCapitalAccount) {
        this.paymentCapitalAccount = paymentCapitalAccount;
    }

    public String getIncomeCapitalAccount() {
        return incomeCapitalAccount;
    }

    public void setIncomeCapitalAccount(String incomeCapitalAccount) {
        this.incomeCapitalAccount = incomeCapitalAccount;
    }
}
